package il.technion.ewolf.shades;

import java.util.List;
import java.util.TimerTask;
import java.util.concurrent.ExecutorService;

import com.google.inject.Inject;
import com.google.inject.Provider;
import com.google.inject.name.Named;

import il.technion.ewolf.kbr.KeyFactory;
import il.technion.ewolf.kbr.Node;
import il.technion.ewolf.kbr.openkad.BootstrapNodesSaver;
import il.technion.ewolf.kbr.openkad.IncomingContentHandler;
import il.technion.ewolf.kbr.openkad.KadNet;
import il.technion.ewolf.kbr.openkad.NodeStorage;
import il.technion.ewolf.kbr.openkad.handlers.FindNodeHandler;
import il.technion.ewolf.kbr.openkad.handlers.ForwardHandler;
import il.technion.ewolf.kbr.openkad.handlers.PingHandler;
import il.technion.ewolf.kbr.openkad.handlers.StoreHandler;
import il.technion.ewolf.kbr.openkad.msg.ContentMessage;
import il.technion.ewolf.kbr.openkad.msg.ContentRequest;
import il.technion.ewolf.kbr.openkad.net.Communicator;
import il.technion.ewolf.kbr.openkad.net.MessageDispatcher;
import il.technion.ewolf.kbr.openkad.op.FindValueOperation;
import il.technion.ewolf.kbr.openkad.op.JoinOperation;
import il.technion.ewolf.shades.handlers.ShadesFindNodeHandler;

public class ShadesNet extends KadNet{

	@Inject
	ShadesNet(
			Provider<MessageDispatcher<Object>> msgDispatcherProvider,
			Provider<JoinOperation> joinOperationProvider,
			Provider<ContentRequest> contentRequestProvider,
			Provider<ContentMessage> contentMessageProvider,
			Provider<IncomingContentHandler<Object>> incomingContentHandlerProvider,
			@Named("openkad.op.findvalue") Provider<FindValueOperation> findValueOperationProvider,
			Provider<FindNodeHandler> findNodeHandlerProvider,
			Provider<PingHandler> pingHandler,
			Provider<StoreHandler> storeHandlerProvider,
			Provider<ForwardHandler> forwardHandlerProvider,
			
			@Named("openkad.local.node") Node localNode,
			Communicator kadServer,
			NodeStorage nodeStorage,
			KeyFactory keyFactory,
			@Named("openkad.executors.client") ExecutorService clientExecutor,
			@Named("openkad.bucket.kbuckets.maxsize") int bucketSize,
			@Named("openkad.refresh.task") TimerTask refreshTask,
			BootstrapNodesSaver bootstrapNodesSaver,
			
			//testing
			@Named("openkad.testing.findNodeHopsHistogram") List<Integer> findNodeHopsHistogram,
			Provider<ShadesFindNodeHandler> shadesFindNodeHandlerProvider){
		super(msgDispatcherProvider, joinOperationProvider, contentRequestProvider,
				contentMessageProvider, incomingContentHandlerProvider,
				findValueOperationProvider, findNodeHandlerProvider, pingHandler,
				storeHandlerProvider, forwardHandlerProvider, localNode, kadServer,
				nodeStorage, keyFactory, clientExecutor, bucketSize, refreshTask,
				bootstrapNodesSaver, findNodeHopsHistogram);
	}

}
